/* $VER: Search.rexx 1.0 (31.8.99) (c) Neil Bothwick, Wirenet */ /* ;;; Initialise */ options results signal on error CDName = 'AACD10' call LoadLib('rexxsupport.library') call LoadLib('rexxdossupport.library') call LoadLib('rexxreqtools.library') parse arg args args = compress(args,'a0'x) do until args = '' parse var args a '"' b '"' args interpret a||'"'||b||'"' args = strip(args,'L') end if SearchStr = '' then call ExitMsg('You must give a string to search for') 'urlencode "'SearchStr'" var SearchEnc' OutputURL = 'x-aweb:searchresults/'SearchEnc OutputFile = 'T:CDsearch.results' AWebPort = address() if left(AWebPort,5) ~= 'AWEB.' then call ExitMsg('This script can only be run*Nfrom a link inside AWeb') ;;; /* ;;; Search */ Search: call delete(OutputFile) select when Source = 'Amigactive' then do signal off error address command 'FlashFind 'CDName':CDTools/indices/'CDName' "'SearchStr'" NH >'OutputFile if RC = 5 then Matches = 0 signal on error nop end when Source = 'Aminet CDs' then do nop end when Source = 'Aminet' then do nop end otherwise nop end /* Show matches or warn if none */ /* if word(statef(OutFile),2) = 0 then call ReqMsg('No matches found for "'SearchStr'"') else address command 'Multiview' OutFile 'gauge id PROGR attrs' MUIA_Gauge_Current 0 MUIA_Gauge_InfoText '""' return */ ;;; /* ;;; Output results */ 'chanopen' OutputURL ChanID = result 'chanheader' ChanID '"Content-Type: text/html"' 'chanheader' ChanID '"Pragma: No-cache"' 'chandata' ChanID '"
" newline' 'chandata' ChanID '"
'name' | 'path'" newline' end 'chandata' ChanID '" |
Another search" newline' 'chandata' ChanID '"" newline' 'chanclose' ChanID call close(res) 'open' OutputURL ;;; /* ;;; Cleanup and exit */ CleanUp: call delete(OutputFile) call close(res) exit ;;; /* ;;; Exit with a message */ ExitMsg: parse arg msg call ShowMsg(msg) call CleanUp() return ;;; /* ;;; Error handler */ Error: call ExitMsg('Error' RC 'in line' sigl) return ;;; /* ;;; Show a message in a requester */ ShowMsg: parse arg msg 'request "Amigactive CD" "'msg'" "OK" nowait' return ;;; /* ;;; Load library */ LoadLib: parse arg library if show('L',library) then return if ~exists('LIBS:'library) then address command 'copy 'CDName':System/libs/'library 'LIBS: clone quiet' if ~addlib(library,0,-30,0) then call ExitMsg('Failed to load' library||'0a'x||'Make sure you have run InitCD') return ;;;